package rest.jbpm.wrappers;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jbpm.api.Execution;

@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(name = "", propOrder = {
    "executions"
})
public class ChildExecutions {
	
	private Collection<? extends org.jbpm.api.Execution> executions;
	private String baseUri;
	
	protected ChildExecutions() {
		
	}

	public ChildExecutions(Collection<? extends Execution> executions, String baseUri) {
		// TODO Auto-generated constructor stub
		this.executions = executions;
		this.baseUri = baseUri;
	}

	@XmlElement(name="executions")
    public List<rest.jbpm.wrappers.Execution> getExecutions() {
		
    	ArrayList<rest.jbpm.wrappers.Execution> children = new ArrayList<rest.jbpm.wrappers.Execution>();
    	
    	for(org.jbpm.api.Execution child : executions) {
    		children.add(new rest.jbpm.wrappers.Execution(child,baseUri));
    	}
        return children;
    }

}
